<!doctype html>
<html>

<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>教师界面</title>
<meta name="description" content="这是教师主页">
<meta name="keywords" content="index">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="renderer" content="webkit">
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="icon" type="image/png" href="../img/njust.ico">
<link rel="stylesheet" href="../amazeui/css/amazeui.min.css" />
<link rel="stylesheet" href="css/admin.css">
<link rel="stylesheet" href="css/app.css">
</head>

<body style="margin-left: 10px; overflow: hidden;">

	<div id="ref_page" class="am-g">
	
	    <div class="tpl-content-page-title" style="margin-bottom: 10px;">下载学生的各项材料</div>
		<div class="am-panel am-panel-default">
			<div class="am-panel-bd am-scrollable-horizontal">
				
				<div class="am-u-sm-12">
	                  <table class="am-table am-table-centered am-table-striped am-table-hover table-main">
	                      <thead>
	                          <tr>
	                              <th class="table-id">编号</th>
	                              <th class="table-title">姓名</th>
	                              <th>专业</th>
	                              <th>年级</th>
	                              <th>班级</th>
	                              <th>电话号码</th>
	                              <th>开题报告表</th>
	                              <th>中期检查表</th>
	                              <th>免答辩申请表</th>
	                              <th>论文</th>
	                          </tr>
	                      </thead>
	                      <tbody id="studownbody"></tbody>
	                  </table>
                </div>
			</div>
		</div>

	</div>

	<script src="../js/jquery.min.js"></script>
	<script src="../amazeui/js/amazeui.min.js"></script>
	<script type="text/javascript">
		$(function() {
			
			//检查学生是否提交了免答辩申请,没有则隐藏下载免答辩按钮
			if(true){
				$('.mdb_btn').addClass('am-disabled');
                $.get('/graduation/teacherController/getStudentByTeacherId2',function(data){
                	$(data).each(function(index,value){
                		var td1=$('<td>').addClass('am-text-middle').text((index+1));
                		var td2=$('<td>').addClass('am-text-middle').append($('<span>').text(value.user.userName));
                		var td3=$('<td>').addClass('am-text-middle').append($('<span>').text(value.classInfo.subject.subjectName));
                		var td4=$('<td>').addClass('am-text-middle').append($('<span>').text(value.classInfo.grade.gradeName));
                		var td5=$('<td>').addClass('am-text-middle').append($('<span>').text(value.classInfo.className));
                		var td6=$('<td>').addClass('am-text-middle').append($('<span>').text(value.user.userTel));
                		if(value.ktbg==null){
                 		var ktbgBtn=$('<button>').attr('disabled','disabled').addClass('am-btn am-btn-primary am-btn-sm ktbg_btn').text('下载').append($('<i>').addClass('am-icon-cloud-download'));
                 		var td7=$('<td>').addClass('am-text-middle').append(ktbgBtn);
                		}else{
                			var ktbgBtn=$('<button>').addClass('am-btn am-btn-primary am-btn-sm ktbg_btn').text('下载').append($('<i>').addClass('am-icon-cloud-download'));
                 		var td7=$('<td>').addClass('am-text-middle').append(ktbgBtn);
                		}
                		if(value.zqjc==null){
                			var ZqjcBtn=$('<button>').attr('disabled','disabled').addClass('am-btn am-btn-primary am-btn-sm zqjc_btn').text('下载').append($('<i>').addClass('am-icon-cloud-download'));
                    		var td8=$('<td>').addClass('am-text-middle').append(ZqjcBtn);
                		}else{
                 		var ZqjcBtn=$('<button>').addClass('am-btn am-btn-primary am-btn-sm zqjc_btn').text('下载').append($('<i>').addClass('am-icon-cloud-download'));
                 		var td8=$('<td>').addClass('am-text-middle').append(ZqjcBtn);
                		}
                		if(value.mdb==null){
                			var MdbBtn=$('<button>').attr('disabled','disabled').addClass('am-btn am-btn-primary am-btn-sm mdb_btn').text('下载').append($('<i>').addClass('am-icon-cloud-download'));
                    		var td9=$('<td>').addClass('am-text-middle').append(MdbBtn);
                		}else{
                 		var MdbBtn=$('<button>').addClass('am-btn am-btn-primary am-btn-sm mdb_btn').text('下载').append($('<i>').addClass('am-icon-cloud-download'));
                 		var td9=$('<td>').addClass('am-text-middle').append(MdbBtn);
                		}
                		if(value.lunwen==null){
                			var LunwenBtn=$('<button>').attr('disabled','disabled').addClass('am-btn am-btn-primary am-btn-sm lunwen_btn').text('下载').append($('<i>').addClass('am-icon-cloud-download'));
                    		var td10=$('<td>').addClass('am-text-middle').append(LunwenBtn);
                		}else{
                 		var LunwenBtn=$('<button>').addClass('am-btn am-btn-primary am-btn-sm lunwen_btn').text('下载').append($('<i>').addClass('am-icon-cloud-download'));
                 		var td10=$('<td>').addClass('am-text-middle').append(LunwenBtn);
                		}
                		var tr=$('<tr>').append(td1).append(td2).append(td3).append(td4).append(td5).append(td6).append(td7).append(td8).append(td9).append(td10);
                		tr.append($('<input>').attr({'type':'hidden','name':'studentId'}).val(value.studentId));
                		$('#studownbody').append(tr);
		                //绑定事件
		               $('.ktbg_btn').click(function(){
		               	  var studentId=$(this).parent().parent().find('input:hidden[name=studentId]').val();
		               	  window.location.href ='/graduation/studentController/downKtbg?studentId='+studentId;
		               });
		               $('.zqjc_btn').click(function(){
		               	  var studentId=$(this).parent().parent().find('input:hidden[name=studentId]').val();
		               	  window.location.href ='/graduation/studentController/downZqjc?studentId='+studentId;
		               });
		               $('.lunwen_btn').click(function(){
		               	  var studentId=$(this).parent().parent().find('input:hidden[name=studentId]').val();
		               	  window.location.href ='/graduation/lunwenController/downloadResource?studentId='+studentId;
		               });
		               $('.mdb_btn').click(function(){
		               	  var studentId=$(this).parent().parent().find('input:hidden[name=studentId]').val();
		               	  window.location.href ='/graduation/studentController/downMdb?studentId='+studentId;
		               });
                	});
                });
			}

		});
	</script>
</body>

</html>